require.config({
    urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
    packages: [],
    //在打包压缩时将会把include中的模块合并到主文件中
    include: [],
    paths: {
        'pageeditor': 'require-util-pageeditor',
        'tip': 'require-util-tip',
        'jquery': '../libs/jquery/dist/jquery-2.1.4.min',
        'jquery.confirm': '../libs/jquery-confirm/jquery-confirm',
        'jquery.ui': '../libs/jquery-ui/jquery-ui.min',
        'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
        'template': '../libs/art-template/dist/template',
        'swiper': '../libs/swiper/dist/js/swiper',
    },
    // shim依赖配置
    shim: {
        'bootstrap': ['jquery'],
        'jquery.ui': {
            deps: ['jquery', 'css!../libs/jquery-ui/jquery-ui.min.css']
        },
        'jquery.confirm': {
            deps: ['jquery', 'css!../libs/jquery-confirm/jquery-confirm.css']
        },
        'swiper': {
            deps: ['css!../libs/swiper/dist/css/swiper.css'],
        },
    },
    baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
    map: {
        '*': {
            'css': '../libs/require-css/css.min'
        }
    },
    waitSeconds: 30,
    charset: 'utf-8' // 文件编码
});

require(['jquery', 'bootstrap', 'tip'], function ($, undefined, undefined) {
    //初始配置
    var Config = requirejs.s.contexts._.config.config;
    //将Config渲染到全局
    window.Config = Config;
    // 配置语言包的路径
    var paths = {};
    // 避免目录冲突
    paths['app/'] = 'app/';
    require.config({paths: paths});

    // 初始化
    $(function () {
        //加载相应模块
        if (Config.jsname) {
            require([Config.jsname], function (Controller) {
                Controller[Config.actionname] != undefined && Controller[Config.actionname]();
            }, function (e) {
                console.error(e);
                // 这里可捕获模块加载的错误
            });
        }
    });
});
